Repository navigation
feat(slack): charts in messages from OpenWork - #7843
benjaminshafii wants to merge 1 commit into
Conversation
Adds a `chart` component to the Slack component vocabulary, sent as Slack's `data_visualization` block (line, area, bar, pie), under the existing `slackRichMessages` flag. - Every documented limit is checked before sending: two charts a message, title 50, labels and names 20, 12 series or segments, 20 points, unique series names, one point per category, pie values above zero, axis labels 50. - A chart outside those limits, or a third chart, is sent as a table with the same numbers, or as text when the message already has a table. Only data that cannot be read (values that do not match the categories, a pie with no segments) is refused. - The message text carries every number, so notifications, screen readers and the plain retry still give the data. - When Slack refuses a message with a chart (a block error or invalid_arguments) it is posted again with the chart as a table before the existing plain retry. - Desktop results now read the fenced `slack` block, so a chart can appear there too. - Agents are told when a chart beats a table and when it does not. - The sample Slack validates the block against the reference and draws it; the proof, the API test and the examples cover it. Same flag rather than a new one: a chart is one more component of a rollout that is still off by default, a refused chart degrades to a table on its own, and the flag already returns every surface to text. Nothing here was sent to a real Slack workspace.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Chart examples (sample renderer, not Slack)Each picture is the message OpenWork's code produced for the input above it, drawn by the sandbox's sample Slack at 32d6e00. Real Slack will draw the same block its own way; nothing here was sent to a real workspace. Weekly active users as a line chart (flag on)Where: The Slack assistant's answer to a mention or DM Made with: The assistant's last message: Weekly active users reached **1,402** last week, up 32% in eight weeks. The one dip was the week of Nov 9, when imports were down for two days.
```slack
[
{
"type": "chart",
"kind": "line",
"title": "Weekly active users",
"categories": [
"Oct 5",
"Oct 12",
"Oct 19",
"Oct 26",
"Nov 2",
"Nov 9",
"Nov 16",
"Nov 23"
],
"series": [
{
"name": "Users",
"values": [
1062,
1098,
1120,
1180,
1240,
1228,
1315,
1402
]
}
],
"xLabel": "Week starting",
"yLabel": "Active users"
},
{
"type": "context",
"text": "From the product database, read just now"
}
]
```Pipeline by stage as a bar chart (flag on)Where: An Automation run sending with Made with: Tool call: {
"target": "me",
"text": "Pipeline by stage: $264k open, up $20k on last week. Negotiation is the only stage that shrank.",
"components": [
{
"type": "chart",
"kind": "bar",
"title": "Pipeline by stage",
"categories": [
"Qualified",
"Proposal",
"Negotiation",
"Won this month"
],
"series": [
{
"name": "Last week",
"values": [
88,
71,
61,
24
]
},
{
"name": "This week",
"values": [
96,
82,
54.5,
31.5
]
}
],
"xLabel": "Stage",
"yLabel": "Value ($k)"
},
{
"type": "context",
"text": "Weekly pipeline report, ran Mon Nov 23 at 9:00 AM"
},
{
"type": "buttons",
"buttons": [
{
"text": "Open the pipeline",
"url": "https://crm.example.com/pipeline"
}
]
}
]
}Spend by model as a pie chart (flag on)Where: A chat or Automation sending with Made with: Tool call: {
"target": "me",
"text": "AI spend so far in November is $1,040. Atlas Large is most of it.",
"components": [
{
"type": "chart",
"kind": "pie",
"title": "Spend by model",
"segments": [
{
"label": "Atlas Large",
"value": 620
},
{
"label": "Atlas Fast",
"value": 255
},
{
"label": "Embeddings",
"value": 125
},
{
"label": "Other",
"value": 40
}
]
},
{
"type": "context",
"text": "From the billing export, Nov 1 to Nov 27, in dollars"
}
]
}A chart with more points than Slack draws, sent as a table (flag on)Where: A chat or Automation sending with Made with: Tool call: {
"target": "me",
"text": "Signups by week since June: 468 last week, the highest so far.",
"components": [
{
"type": "chart",
"kind": "line",
"title": "Signups by week",
"categories": [
"Jun 1",
"Jun 8",
"Jun 15",
"Jun 22",
"Jun 29",
"Jul 6",
"Jul 13",
"Jul 20",
"Jul 27",
"Aug 3",
"Aug 10",
"Aug 17",
"Aug 24",
"Aug 31",
"Sep 7",
"Sep 14",
"Sep 21",
"Sep 28",
"Oct 5",
"Oct 12",
"Oct 19",
"Oct 26",
"Nov 2",
"Nov 9",
"Nov 16",
"Nov 23"
],
"series": [
{
"name": "Signups",
"values": [
251,
263,
258,
270,
284,
279,
291,
305,
298,
312,
320,
317,
331,
344,
339,
352,
360,
371,
366,
380,
395,
389,
404,
398,
412,
468
]
}
],
"xLabel": "Week starting"
},
{
"type": "context",
"text": "From the product database"
}
]
} |




What is this about?
Messages the OpenWork app posts in Slack can now include a line, area, bar or pie chart: a new
chartcomponent next to tables and buttons, under the sameslackRichMessagesflag.What problem does it solve?
A trend or a share of a whole reads badly as a table of numbers, and agents had no other way to show one in Slack.
What was the situation before?
Every
chartcomponent was refused and nothing was posted.How is this implemented?
slack-assistant/rich-message.ts:chartjoins the strict component schema and is sent as Slack'sdata_visualizationblock, with every documented limit checked first.textcarries every number, for notifications, screen readers and the plain retry.What else changed?
slackblock, so they can carry a chart.--only=to redraw some pictures.Release note
none
Evidence
evals/proofs/slack-rich-messages.proof.test.ts: before, the chart message is refused; after, the sample Slack draws a line and a pie, and an oversize or third chart arrives as a table. Pictures come from the sample renderer. Nothing was sent to a real Slack workspace.